<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.18"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>HElib: helib::GeneralBenesNetwork Class Reference</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="customdoxygen.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
		<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,100;1,700&family=Merriweather&family=Merriweather+Sans&family=Open+Sans&family=Poppins:ital@1&family=Roboto:ital,wght@0,400;1,300;1,900&display=swap" rel="stylesheet"> 
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body style="font-family: 'Merriweather', serif;">
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand">HElib Implementing Homomorphic Encryption</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.18 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespacehelib.html">helib</a></li><li class="navelem"><a class="el" href="classhelib_1_1_general_benes_network.html">GeneralBenesNetwork</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="classhelib_1_1_general_benes_network-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">helib::GeneralBenesNetwork Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Implementation of generalized Benes Permutation Network.  
 <a href="classhelib_1_1_general_benes_network.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="permutations_8h_source.html">permutations.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a52650b15e6be5b81c21c810a3317435f"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#a52650b15e6be5b81c21c810a3317435f">getDepth</a> () const</td></tr>
<tr class="separator:a52650b15e6be5b81c21c810a3317435f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae53c9f8e60c303de64a106e84069d17c"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#ae53c9f8e60c303de64a106e84069d17c">getSize</a> () const</td></tr>
<tr class="separator:ae53c9f8e60c303de64a106e84069d17c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a9e9329ff90053d6c4fab07b0a32fa509"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#a9e9329ff90053d6c4fab07b0a32fa509">getNumLevels</a> () const</td></tr>
<tr class="separator:a9e9329ff90053d6c4fab07b0a32fa509"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ab3837bf4ffb077d12aaea5e923993b"><td class="memItemLeft" align="right" valign="top">const NTL::Vec&lt; short &gt; &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#a8ab3837bf4ffb077d12aaea5e923993b">getLevel</a> (long i) const</td></tr>
<tr class="separator:a8ab3837bf4ffb077d12aaea5e923993b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aaa72d3cd338814502f87796a68f95925"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#aaa72d3cd338814502f87796a68f95925">levelToDepthMap</a> (long i) const</td></tr>
<tr class="separator:aaa72d3cd338814502f87796a68f95925"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa3221b4f153e00ed2b3659111a698fc8"><td class="memItemLeft" align="right" valign="top">long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#aa3221b4f153e00ed2b3659111a698fc8">shamt</a> (long i) const</td></tr>
<tr class="separator:aa3221b4f153e00ed2b3659111a698fc8"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a33663c68ca940f078ee6aacef19b81ce"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#a33663c68ca940f078ee6aacef19b81ce">GeneralBenesNetwork</a> (const <a class="el" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a> &amp;perm)</td></tr>
<tr class="separator:a33663c68ca940f078ee6aacef19b81ce"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae0d074af92f13a6e09424f07348e08cd"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#ae0d074af92f13a6e09424f07348e08cd">testNetwork</a> (const <a class="el" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a> &amp;perm) const</td></tr>
<tr class="separator:ae0d074af92f13a6e09424f07348e08cd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:ae86d8873a231c2834359507781f6dfc3"><td class="memItemLeft" align="right" valign="top">static long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#ae86d8873a231c2834359507781f6dfc3">depth</a> (long n)</td></tr>
<tr class="separator:ae86d8873a231c2834359507781f6dfc3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad12ab0c6ab25a9576d4f52102036d2ec"><td class="memItemLeft" align="right" valign="top">static long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#ad12ab0c6ab25a9576d4f52102036d2ec">levelToDepthMap</a> (<a class="el" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> long n, long k, long i)</td></tr>
<tr class="separator:ad12ab0c6ab25a9576d4f52102036d2ec"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7743131bdd9828324785b1d1ab329c2e"><td class="memItemLeft" align="right" valign="top">static long&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classhelib_1_1_general_benes_network.html#a7743131bdd9828324785b1d1ab329c2e">shamt</a> (long n, long k, long i)</td></tr>
<tr class="separator:a7743131bdd9828324785b1d1ab329c2e"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Implementation of generalized Benes Permutation Network. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="a33663c68ca940f078ee6aacef19b81ce"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a33663c68ca940f078ee6aacef19b81ce">&#9670;&nbsp;</a></span>GeneralBenesNetwork()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">helib::GeneralBenesNetwork::GeneralBenesNetwork </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a> &amp;&#160;</td>
          <td class="paramname"><em>perm</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ae86d8873a231c2834359507781f6dfc3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae86d8873a231c2834359507781f6dfc3">&#9670;&nbsp;</a></span>depth()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static long helib::GeneralBenesNetwork::depth </td>
          <td>(</td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>n</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>computes recursion depth k for generalized Benes network of size n. the actual number of levels in the network is 2*k-1 </p>

</div>
</div>
<a id="a52650b15e6be5b81c21c810a3317435f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a52650b15e6be5b81c21c810a3317435f">&#9670;&nbsp;</a></span>getDepth()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">long helib::GeneralBenesNetwork::getDepth </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a8ab3837bf4ffb077d12aaea5e923993b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8ab3837bf4ffb077d12aaea5e923993b">&#9670;&nbsp;</a></span>getLevel()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">const NTL::Vec&lt;short&gt;&amp; helib::GeneralBenesNetwork::getLevel </td>
          <td>(</td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>i</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a9e9329ff90053d6c4fab07b0a32fa509"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a9e9329ff90053d6c4fab07b0a32fa509">&#9670;&nbsp;</a></span>getNumLevels()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">long helib::GeneralBenesNetwork::getNumLevels </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="ae53c9f8e60c303de64a106e84069d17c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae53c9f8e60c303de64a106e84069d17c">&#9670;&nbsp;</a></span>getSize()</h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">long helib::GeneralBenesNetwork::getSize </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="aaa72d3cd338814502f87796a68f95925"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaa72d3cd338814502f87796a68f95925">&#9670;&nbsp;</a></span>levelToDepthMap() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">long helib::GeneralBenesNetwork::levelToDepthMap </td>
          <td>(</td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>i</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="ad12ab0c6ab25a9576d4f52102036d2ec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad12ab0c6ab25a9576d4f52102036d2ec">&#9670;&nbsp;</a></span>levelToDepthMap() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static long helib::GeneralBenesNetwork::levelToDepthMap </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="api_attributes_8h.html#addf5ec070e9499d36b7f2009ce736076">UNUSED</a> long&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>k</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>i</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>maps a level number i = 0..2*k-2 to a recursion depth d = 0..k-1 using the formula d = (k-1)-|(k-1)-i| </p>

</div>
</div>
<a id="aa3221b4f153e00ed2b3659111a698fc8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa3221b4f153e00ed2b3659111a698fc8">&#9670;&nbsp;</a></span>shamt() <span class="overload">[1/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">long helib::GeneralBenesNetwork::shamt </td>
          <td>(</td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>i</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

</div>
</div>
<a id="a7743131bdd9828324785b1d1ab329c2e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7743131bdd9828324785b1d1ab329c2e">&#9670;&nbsp;</a></span>shamt() <span class="overload">[2/2]</span></h2>

<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static long helib::GeneralBenesNetwork::shamt </td>
          <td>(</td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>n</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>k</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">long&#160;</td>
          <td class="paramname"><em>i</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">
<p>shift amount for level number i=0..2*k-2 using the formula ceil( floor(n/2^d) / 2), where d = levelToDepthMap(i) </p>

</div>
</div>
<a id="ae0d074af92f13a6e09424f07348e08cd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae0d074af92f13a6e09424f07348e08cd">&#9670;&nbsp;</a></span>testNetwork()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool helib::GeneralBenesNetwork::testNetwork </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="namespacehelib.html#ae0769a209e14d5e1bfd8579072397867">Permut</a> &amp;&#160;</td>
          <td class="paramname"><em>perm</em></td><td>)</td>
          <td> const</td>
        </tr>
      </table>
</div><div class="memdoc">

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/HElib/include/helib/<a class="el" href="permutations_8h_source.html">permutations.h</a></li>
<li>/HElib/src/<a class="el" href="_benes_network_8cpp.html">BenesNetwork.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.18
</small></address>
</body>
        <script type="text/javascript" src="doxy-boot.js"></script>
</html>
